;;; packages.el --- ctrl-programming layer packages file for Spacemacs.
;;

(defconst ctrl-programming-packages
  '(
    magit
    yasnippet
    (python :location built-in)
    importmagic))

(defun ctrl-programming/post-init-yasnippet ()
  (progn
    (set-face-background 'secondary-selection "gray")
    (setq-default yas-prompt-functions '(yas-ido-prompt yas-dropdown-prompt))
    (mapc #'(lambda (hook) (remove-hook hook 'spacemacs/load-yasnippet)) '(prog-mode-hook
                                                                           org-mode-hook
                                                                           markdown-mode-hook))

    (spacemacs/add-to-hooks 'ctrl-programming/load-yasnippet '(prog-mode-hook
                                                            markdown-mode-hook
                                                            org-mode-hook))))

(defun ctrl-programming/post-init-python ()
  ;; to get rid of warning like when use session on org mode
  ;; Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support
  ;; readline, yet ‘python-shell-completion-native-enable’ was t and "python"
  ;; is not part of the ‘python-shell-completion-native-disabled-interpreters’
  ;; list. Native completions have been disabled locally.
  (setq python-shell-completion-native-enable nil))

(defun ctrl-programming/post-init-importmagic ()
  ;; disable importmagic mode when editing python file
  (remove-hook 'python-mode-hook 'importmagic-mode))


(defun ctrl-programming/post-init-magit ()
  ;; Restore window configuration and kill all Magit buffers.
  (with-eval-after-load 'magit-status
    (define-key magit-status-mode-map (kbd "q") #'ctrl-programming/mu-magit-kill-buffers)))


;;; packages.el ends here
